﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace SnakeGame
{
    public class SnakeGame 
    {
        private  Snake _snake;
        private  Field _field;
        private Render _render;
        private SnakeDrawing _drawer;
        private Controller _controllerStrategy;     
        private bool _gameOver = false;
    
        
        public void StartGame()
        {
            
            _drawer = new SnakeDrawing();
            _field = new Field();
            _snake = new Snake();
            SnakeGameLoop();
            
        }
        public void SnakeGameLoop()
        {
            _controllerStrategy = new Controller();
            _render = new Render();
            for (; _gameOver == false; _drawer.X++, _render.Rendering())
            {                        
                _field.PaintField();
                _drawer.SetSnakePosition();
                _controllerStrategy.ChangeDirection();                                            
                _drawer.DrawSnake();                                
                Thread.Sleep(500);
            }
        }
  
    }
}
